package com.example.jetpacktest.coroutine

import org.junit.Test

class YieldTest001 {


    @Test
    fun test001(){
        val sequence = sequence {
            val start = 0
            // yielding a single value
            yield(start)
            // yielding an iterable
            yieldAll(1..5 step 2)
            // yielding an infinite sequence
            yieldAll(generateSequence(8) { it * 3 })
        }

        //println(sequence.first())
        println(sequence.take(3).toList())

    }


}